package com.mp3.player.vos
{
	import flash.media.ID3Info;
	
	import mx.utils.UIDUtil;

	public class Track
	{
		public function Track(url: String = null)
		{
			this.url = url;
		}
		
		[Bindable]
		public var name:String;
		
		[Bindable]
		public var artist:String;
		
		[Bindable]
		public var url:String;
		
		[Bindable]
		public var length:Number = 0;
		
		[Bindable]
		public var album: String;
		
		[Bindable]
		public var albumUrl: String;
		
		[Bindable]
		public var genre: String;
		
		[Bindable]
		public var year: String;
		
		[Bindable]
		public var index: int;
		
		[Bindable]
		public var selected: Boolean = false;
		
		
		/**
		 * Function to set track properties from track info. Properties is not overriden. 
		 * @param info
		 * 
		 */		
		public function set id3(info: ID3Info): void
		{
			if (name == null || name == "")
			{
				name = info.songName;
			}
			
			if (artist == null || artist == "")
			{
				artist = info.artist;
			}
			
			if (album == null || album == "")
			{
				album = info.album;
			}
			
			if (genre == null || genre == "")
			{
				genre = info.genre;
			}
			
			if (year == null || year == "")
			{
				year = info.year;
			}
		}
	}
}